// 自己封装的一些方法
const TOKEN_NAME = 'geek-token';

export const setToken = token => {
  return localStorage.setItem(TOKEN_NAME, token);
};

export const getToken = () => {
  return localStorage.getItem(TOKEN_NAME);
};

export const removeToken = () => {
  return localStorage.removeItem(TOKEN_NAME);
};

// 判断是否有token
export const hasToken = () => {
  // !!强制类型转换为boolean，等同于Boolean()
  return !!getToken();
};
